import time
import os
from concurrent.futures import ProcessPoolExecutor
import setproctitle
from multiprocessing import Process

def wait_on_a():
    print('a', os.getpid())
    print('start a')
    os._exit(2)
    time.sleep(5)
    print("over a")  # a will never complete because it is waiting on b.
    return 6

def wait_on_b():
    print('b',os.getpid(), "ppid", os.getppid())
    print('start b')
    time.sleep(50)
    print("over b")  # a will never complete because it is waiting on b.
    return 6

def wait_on_c():
    print('c',os.getpid(), "ppid", os.getppid())
    print('start c')
    time.sleep(50)
    print("over c")  # a will never complete because it is waiting on b.
    return 6

try:

    executor = ProcessPoolExecutor(max_workers=2)
    executor.submit(wait_on_a)
    print('s1')
    executor.submit(wait_on_b)
    print('s2')
    executor.submit(wait_on_c)
    print('s3')

except Exception as e:
    print(e)

# executor.submit(wait_on_c)
# executor.submit(wait_on_c)
# executor.submit(wait_on_c)